<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="{$Think.config.BOOTSTRAP_CSS_URL}bootstrap.css">
    <script src="{$Think.config.BOOTSTRAP_JS_URL}jquery.min.js"></script>
    <script src="{$Think.config.BOOTSTRAP_JS_URL}bootstrap.js"></script>
    <style>
        .add_item {
            float: right;
            position: relative;
        }

        .user_item_input {
            padding: 5px;
            margin: 10px;
        }
    </style>
</head>
<body>
<!-- 页面初始化处理-->
<script>
    $(function () {
        $('#autoTogglePanel').click();
    })
</script>
<div class="container">

    <a id="autoTogglePanel" href="" data-toggle="modal" data-target="#addItemPanel"></a>
    <!--弹出框-->
    <!-- Modal -->
    <form action="{:U('Team/updateTeam')}" class="form-inline" method="post">
        <input type="hidden" name="t_id" value="{$teamInfo.t_id}">
        <div class="modal fade" id="addItemPanel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">修改组信息</h4>
                    </div>
                    <div class="modal-body" id="userAddPanel">

                        <div class="form-group user_item_input">
                            <label for="sysname">小组系统名称：</label>
                            <input name="teamName" type="text" class="form-control" id="sysname" value="{$teamInfo.t_project_name}">
                            <select name="category" class="form-control drop_down_add">
                                <option value="-1">-请选择课程-</option>
                                <foreach name="teamCategory" item="v">

                                    <option value="{$v.cat_id}"
                                    <if condition="$catId eq $v['cat_id']"> selected</if>
                                    >{$v.cat_name}</option>
                                </foreach>
                            </select>
                        </div>
                        <div class="user_item_input">
                            <div class="form-group">
                                <label for="leader_name">组长：</label>
                                <input name="leaderName" type="text" class="form-control" id="leader_name" value="{$teamInfo.t_leader_name}" >
                            </div>
                            <div class="form-group">
                                <label class="sr-only" for="leader_num">组长学号：</label>
                                <input name="leaderNum" type="text" class="form-control" id="leader_num"
                                       value="{$teamInfo.t_leader_num}">
                            </div>

                        </div>
                        <hr>

                        <span style="position:relative;float: right;top:-10px;" onclick="addUser()" class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                        <foreach name="teamInfo['t_user_info']" item="v">
                        <div class="user_item_input">
                            <div class="form-group">
                                <label>成员：</label>
                                <input name="userName[]" type="text" class="form-control" value="{$v.name}">
                            </div>
                            <div class="form-group">
                                <label class="sr-only">：</label>
                                <input name="userNum[]" type="text" class="form-control" value="{$v.num}">
                            </div>
                            <span onclick="removeUser(this)" class="glyphicon glyphicon-minus" aria-hidden="true"></span>
                        </div>

                        </foreach>

                        <!--处理多加号-->
                        <script>

                        </script>

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <!--<button type="button" class="btn btn-primary">Save changes</button>-->
                        <input class="btn btn-default" type="submit" value="提交">
                    </div>
                </div>
            </div>
        </div>
    </form>
    <script>
        function addUser() {
            var user = '<div class="user_item_input">\n' +
                '\t\t\t\t\t\t\t\t<div class="form-group">\n' +
                '\t\t\t\t\t\t\t\t\t<label>成员：</label>\n' +
                '\t\t\t\t\t\t\t\t\t<input name="userName[]" type="text" class="form-control" placeholder="成员姓名">\n' +
                '\t\t\t\t\t\t\t\t</div>\n' +
                '\t\t\t\t\t\t\t\t<div class="form-group">\n' +
                '\t\t\t\t\t\t\t\t\t<label class="sr-only" >：</label>\n' +
                '\t\t\t\t\t\t\t\t\t<input name="userNum[]" type="text" class="form-control"  placeholder="成员学号">\n' +
                '\t\t\t\t\t\t\t\t</div>\n' +
                '\t\t\t\t\t\t\t\t<span onclick="removeUser(this)"  class="glyphicon glyphicon-minus" aria-hidden="true"></span>\n' +
                '\t\t\t\t\t\t\t</div>';

            $('#userAddPanel').append(user);
        }

        function removeUser(obj) {
            $(obj).parent().remove();
        }
    </script>
    <!--弹出框结束-->
</div>
</body>
</html>